﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IView;
using Engine;
using DataTransferObject.DiaryAndTrackingTask.SupportClassForDiary;
using IView.DiaryAndTracking;

namespace Presenter
{
    public class PresenterCalendarForm:Presenter
    {
        private ICaldendarForm _view;
        //private IMainForm _mainFormView;
        private IDiaryForm _diaryFormView;
        private List<JskeEvent> _jskeEvent = new List<JskeEvent>();
        private JskeEngine _jskeEngine;


        public PresenterCalendarForm(ICaldendarForm view, int dataServiceMode)
        {
            Presenter.changeDataServiceMode(dataServiceMode);
            _jskeEngine = JskeEngine.getInstance(dataServiceMode);
            this._view = view;
            _jskeEngine.loadDiaryDataToEngine();
        }

        public PresenterCalendarForm(IDiaryForm diaryFormView, ICaldendarForm icalView, int dataServiceMode)
        {
            Presenter.changeDataServiceMode(dataServiceMode);
            _jskeEngine = JskeEngine.getInstance(dataServiceMode);
            _view = icalView;
            _diaryFormView = diaryFormView;
            _jskeEngine.loadDiaryDataToEngine();
        }

        public List<JskeEvent> getListJskeEvent(DateTime from, DateTime to)
        {
            return _jskeEngine.getListJskeEvent(from, to);
        }

        public EventType getEventType()
        {
            return _jskeEngine.loadEventTypeData();
        }

        public void saveListResult(List<JskeEvent> jskeEvents, List<int> listDeletedEventID, List<int> listNewEvent, EventType evt)
        {
            _jskeEngine.saveListResult(jskeEvents, listDeletedEventID, listNewEvent, evt);
        }

        public List<JskeEvent> getScheduleCalendar()
        {
            return _jskeEngine.getScheduleCalendar();
        }
    }
}
